package com.yjc.drygoods.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yjc.common.to.OrderTo;
import com.yjc.common.to.SpuHasStock;
import com.yjc.common.to.StockLockTo;
import com.yjc.common.utils.PageUtils;
import com.yjc.drygoods.ware.entity.WareSpuEntity;
import com.yjc.drygoods.ware.vo.WareLockVo;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author yjc
 * @email yjc19979401754@126.com
 * @date 2022-08-19 23:23:36
 */
public interface WareSpuService extends IService<WareSpuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    void updateWareStock(Long spuId, Long wareId, Double skuNum);

    /**
     * 获取单个spu干货的仓库库存数量
     * @param spuId
     * @return
     */
    Double getSingleSpuWareStock(Long spuId);

    List<SpuHasStock> getHasStock(List<Long> skuIds);

    /**
     * 锁定库存
     *
     * @param wareLockVo
     * @return
     */
    Boolean lockStock(WareLockVo wareLockVo);

    void unLocked(StockLockTo stockLockTo);

    void unLocked(OrderTo orderTo);

    Boolean getSingleSpuWare(Long spuId);

    void clearNeedExchangeSpuStock(Long spuId);

    void deductRealStock(Long spuId, Long wareId, Double skuNum);
}

